import {fetch} from 'cross-fetch'
const basic = "/api/basic/"
export const uploadImage = (data: any) => {
  let formData = new FormData()
  for (let index in data) {
    formData.append(index, data[index])
  }
  return fetch(basic + "upload/image", {
    method: "POST",
    body: formData
  }).then(res => res.json())
}

export const uploadFile = (data: any) => {
  let formData = new FormData()
  for (let index in data) {
    formData.append(index, data[index])
  }
  return fetch(basic + "upload/file", {
    method: "POST",
    body: formData
  }).then(res => res.json())
}